package view.base;

import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.CommandListener;
import javax.microedition.lcdui.Displayable;
import javax.microedition.lcdui.List;

import base.ScreenActionListener;

public class ListScreen extends List implements CommandListener {

	protected final ScreenActionListener controller;

	public ListScreen(ScreenActionListener controller, String name, int type, String[] list){
		super(name, type);

		this.controller = controller;
		if(list!= null)
			for(int i = 0; i<list.length; ++i)
				this.append(list[i], null);

		this.addCommand(new Command("Back", Command.BACK, 0));
	}

	public void commandAction(Command c, Displayable d) {
		switch (c.getCommandType()) {
		case Command.BACK:
			controller.viewAction(Command.BACK, null);
			break;
		}

	}

}
